package org.reactome.cytoscape.v3.internal;

import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.Properties;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;

import org.cytoscape.application.CyApplicationManager;
import org.cytoscape.application.swing.CyAction;
import org.cytoscape.application.swing.CySwingApplication;
import org.cytoscape.io.CyFileFilter;
import org.cytoscape.model.CyNetworkFactory;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.model.CyTableFactory;
import org.cytoscape.model.CyTableManager;
import org.cytoscape.model.events.NetworkAddedListener;
import org.cytoscape.model.events.RowsSetListener;
import org.cytoscape.service.util.AbstractCyActivator;
import org.cytoscape.session.CySession;
import org.cytoscape.session.CySessionManager;
import org.cytoscape.task.edit.MapTableToNetworkTablesTaskFactory;
import org.cytoscape.task.write.SaveSessionTaskFactory;
import org.cytoscape.util.swing.FileUtil;
import org.cytoscape.view.model.events.NetworkViewAddedListener;
import org.gk.util.DialogControlPane;
import org.gk.util.GKApplicationUtilities;
import org.osgi.framework.BundleContext;
import org.cytoscape.service.util.CyServiceRegistrar;
//import org.cytoscape.util.swing.*;




public class CyActivator extends AbstractCyActivator {
    public CyActivator(){
	super();
    }

	@Override
	public void start(BundleContext bc) throws Exception {
		
		CyApplicationManager cyApplicationManager = getService(bc, CyApplicationManager.class);
		CySwingApplication cytoscapeDesktopService = getService(bc, CySwingApplication.class);
		CyNetworkManager networkManager = getService(bc, CyNetworkManager.class);
//		CyNetworkFactory networkFactory = getService(bc, CyNetworkFactory.class);
//		CyFileFilter fileFilter = getService(bc, CyFileFilter.class);
//		CyTableFactory cyDataTableFactoryService = getService(bc, CyTableFactory.class);
//		CyTableManager ctm = getService(bc, CyTableManager.class);
//		MapTableToNetworkTablesTaskFactory mapNetTableFactory = getService(bc, MapTableToNetworkTablesTaskFactory.class);
//		FileUtil fileUtil = getService(bc, FileUtil.class);
//		RowsSetListener rsl = getService(bc, RowsSetListener.class);
//		CyServiceRegistrar cyServiceReg = getService(bc, CyServiceRegistrar.class);
		CySessionManager sessionMgr = getService(bc, CySessionManager.class);
		

		
		//CytoscapeNetworkManager networkManager = new CytoscapeNetworkManager();

		
		//MainMenu action = new MainMenu(cyApplicationManager, "Reactome FIs");
		GeneSetAnalysisAction gsa = new GeneSetAnalysisAction(cytoscapeDesktopService, networkManager, sessionMgr);
		HotNetAnalysisAction hna = new HotNetAnalysisAction(cytoscapeDesktopService, networkManager);
		MicroarrayDataAnalysisAction mda = new MicroarrayDataAnalysisAction(cytoscapeDesktopService, networkManager);
		//CyTableFormatterListener cyTableFormatter = new CyTableFormatterListener();
		UserGuideAction uga = new UserGuideAction(cytoscapeDesktopService);
		registerService(bc, gsa , CyAction.class, new Properties());
		registerService(bc, hna , CyAction.class, new Properties());
		registerService(bc, mda , CyAction.class, new Properties());
		registerService(bc, uga , CyAction.class, new Properties());
		//registerService(bc,cyTableFormatter,NetworkAddedListener.class, new Properties());
		//registerService(bc,cyTableFormatter,NetworkViewAddedListener.class, new Properties());
		//registerService(bc, createTableTask, TableFactory.class, new Properties());
	}
		//registerAllServices(bc, action, properties);
		

		public String describe() {
		        return "This Cytoscape plugin is used to analyze functional interaction data.";
		    }
		

}
